package cn.wolfcode._IOday01_.homeWork;

import java.io.File;
import java.io.FileReader;
import java.io.IOException;

public class Reader {
    public static void main(String[] args) throws IOException {
        //字符输入流
        //方式1
        File file = new File("9527.txt");
        FileReader reader = new FileReader(file);
        System.out.println((char)reader.read());
        System.out.println((char)reader.read());
        System.out.println((char)reader.read());
        System.out.println((char)reader.read());
        //方式2
        //int len ;
        //while ((len = reader.read()) != -1){
        //    System.out.println((char) len);
        //}
        //方式3
        //char[] b = new char[10] ;
        //while(reader.read(b) != -1){
        //    System.out.println(Arrays.toString(b));
        //}
        //方式4
        char[] c = new char[1];
        int off = 0 ;
        int length ;
        while ((length = reader.read(c)) != -1){
            System.out.println("new String (c,0,length) = " + new String(c, 0, length));
        }
        reader.close();
    }
}
